const path = require('path')
// console.log(path.resolve())
// console.log(path.join(__dirname,'./dist'))
module.exports = {
    entry: './src/index.js',
    output: {
        filename: "bundle.js",
        path: path.join(__dirname,'./dist')
    },
    module: {
        rules: [
            {
                test:/\.(scss|sass)$/,
                use: ['style-loader','css-loader','sass-loader']
            },
            {
                test:/\.(png|gif|jpg|svg)$/,
                use: [
                    {
                        loader: 'url-loader', //是指定使用的loader和loader的配置参数
                        options: {
                            limit:500,  //是把小于500B的文件打成Base64的格式，写入JS
                            name: 'images/[name]_[hash:7].[ext]',
                        }
                    }
                ]
            },

            {
                test:/\.(woff|otf|woff2|ttf|eot)$/,
                use: 'file-loader'
            }

        ]
    }
}